'use strict';
var test = require('tape');
var relationship = require('..');

test('[call]', function (t) {
    // console.log('[test]',relationship({text:'**的***姐姐的**'}));

    t.deepEqual(relationship({text:'**的哥哥的弟弟的**'}),['堂哥','堂弟','哥哥','弟弟','自己']);
    t.deepEqual(relationship({text:'**的妹妹的女儿的老公'}),['姑表姐夫','姑表妹夫']);
    t.deepEqual(relationship({text:'表姐的哥哥',***:1}),['姑表哥','舅表哥']);
    t.deepEqual(relationship({text:'表姐的妹妹',***:1}),['姑表姐','姑表妹','舅表姐','舅表妹']);
    t.deepEqual(relationship({text:'弟弟的表哥',***:1}),['姑表哥','姑表弟','舅表哥','舅表弟']);
    t.deepEqual(relationship({text:'姐姐的老公的姐姐的老公'}),['姊妹姻姊妹壻']);
    t.deepEqual(relationship({text:'哥哥的弟弟的**的**',***:1}),['哥哥','弟弟','自己']);
    t.deepEqual(relationship({text:'爱人',***:1}),['老婆']);
    t.deepEqual(relationship({text:'爱人的爱人',***:1}),['自己']);
    t.deepEqual(relationship({text:'老婆的爱人',***:1}),['自己']);
    t.deepEqual(relationship({text:'老婆的老公',***:1}),['自己']);
    t.deepEqual(relationship({text:'老婆的外孙的姥*',***:1}),['自己']);
    t.deepEqual(relationship({text:'老公的老婆的**的**',***:0}),['老公']);
    t.deepEqual(relationship({text:'堂兄弟的孩子',***:1}),['堂侄','堂侄女']);
    t.deepEqual(relationship({text:'**的**的**',***:1}),['**']);
    t.deepEqual(relationship({text:'岳母的配偶的孩子的**'}),['岳父']);
    t.deepEqual(relationship({text:'**的***姐姐的**'}),['姨伯父','姨叔父']);
    t.end();
});
test('[target]', function (t) {
    t.deepEqual(relationship({text:'我',target:'**'}),['**','女儿']);
    t.deepEqual(relationship({text:'老公的父母',target:'孩子'}),['**','**']);
    t.deepEqual(relationship({text:'爱人',target:'娘家侄子'}),['姑丈']);
    t.end();
});
test('[reverse]', function (t) {
    t.deepEqual(relationship({text:'**的舅舅',***:0,reverse:true}),['甥孙女']);
    t.deepEqual(relationship({text:'岳母',target:'女儿',reverse:true}),['外孙女']);
    t.deepEqual(relationship({text:'姑*',target:'舅*',reverse:true}),['兄弟眷兄弟妇']);
    t.deepEqual(relationship({text:'舅*',target:'女儿',reverse:true}),['姑甥孙女','姑甥外孙女']);
    t.deepEqual(relationship({text:'外婆',target:'女婿',reverse:true}),['外曾孙女婿','外曾外孙女婿']);
    t.end();
});
test('[filter]', function (t) {
    t.deepEqual(relationship({text:'内侄'}),['舅侄','舅侄女']);
    t.end();
});
test('[type:chain]', function (t) {
    t.deepEqual(relationship({text:'舅**',type:'chain'}),['**的***兄弟']);
    t.deepEqual(relationship({text:'妻儿',type:'chain'}),['老婆','**','女儿']);
    t.deepEqual(relationship({text:'父母',target:'老公',type:'chain'}),['老婆的**','老婆的**']);
    t.end();
});
test('[type:pair]', function (t) {
    t.deepEqual(relationship({text:'舅*',target:'哥哥',type:'pair'}),['舅甥']);
    t.deepEqual(relationship({text:'舅*',target:'外婆',type:'pair'}),['婆媳']);
    t.deepEqual(relationship({text:'舅*',target:'二舅',type:'pair'}),['伯媳','叔嫂','夫妻']);
    t.deepEqual(relationship({text:'堂哥',target:'叔叔',type:'pair'}),['伯侄', '叔侄', '父子']);
    t.end();
});
test('[age]', function (t) {
    t.deepEqual(relationship({text:'***二哥'}),['二舅']);
    t.deepEqual(relationship({text:'**的二哥'}),['二伯']);
    t.deepEqual(relationship({text:'二舅*',target:'三舅'}),['二嫂']);
    t.deepEqual(relationship({text:'**的二*'}),['二**']);
    t.deepEqual(relationship({text:'姑姑',target:'叔叔',optimal:true}),['姐姐','妹妹']);
    t.deepEqual(relationship({text:'大舅',target:'二舅的**'}),['伯父']);
    t.deepEqual(relationship({text:'二舅*',target:'二舅',type:'pair'}),['夫妻']);
    t.deepEqual(relationship({text:'二舅*',target:'大舅',type:'pair'}),['伯媳']);
    t.end();
});
test('[expression]', function (t) {
    t.deepEqual(relationship('外婆和**之间是什么关系？'),['儿女亲家']);
    t.deepEqual(relationship('**应该如何称呼姑姑'),['姑子']);
    t.deepEqual(relationship('姑**是什么关系'),['**的**的姐妹']);
    t.deepEqual(relationship('姑**和**是什么关系'),['姑侄']);
    t.deepEqual(relationship('我应该叫外婆的哥哥什么？'),['舅外公']);
    t.deepEqual(relationship('七舅姥*应该叫我什么？'),['甥外孙','甥外孙女']);
    t.deepEqual(relationship('舅公是什么关系？'),['**的***兄弟', '******兄弟', '老公的***兄弟']);
    t.deepEqual(relationship('舅*如何称呼外婆？'),['婆婆']);
    t.deepEqual(relationship('外婆和**之间是什么关系？'),['儿女亲家']);
    t.end();
});
